﻿var myApp = angular.module('freelancerModule', ['ngRoute', 'freelancerModule.Controllers', 'freelancerModule.Filters', 'freelancerModule.Services', 'freelancerModule.Directives', 'ui.bootstrap', 'pascalprecht.translate']);

var now = new Date();
myApp.value("nowValue", now);

angular.module("freelancerModule.Filters", []).filter("dayName", function () {
	var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
	return function (input) {
		return angular.isNumber(input) ? dayNames[input] : input;
	};
});

myApp.config(function ($translateProvider) {
    $translateProvider.translations('en', {
        TITLE: 'Hello',
        FOO: 'This is a paragraph.',
        BUTTON_LANG_EN: 'English',
        BUTTON_LANG_ES: 'Español'
    });
    $translateProvider.translations('es', {
        TITLE: 'Hola',
        FOO: 'Esto es un párrafo.',
        BUTTON_LANG_EN: 'English',
        BUTTON_LANG_ES: 'Español'
    });
    $translateProvider.preferredLanguage('es');
});

myApp.config(['$routeProvider',
    function ($routeProvider) {
    	$routeProvider.
            when('/', {
            	templateUrl: 'app/views/home/homeView.html', controller: 'topicsMenuCtrl'
            }).
            when('/map', {
            	templateUrl: 'app/views/map/mapView.html', controller: 'topicsMenuCtrl'
            }).
            otherwise({ redirectTo: '/' });
    }
]);

angular.module("freelancerModule.Services", []).
service("days", function (nowValue) {
	this.today = nowValue.getDay();
	this.tomorrow = this.today + 1;
}).
service("years", function (nowValue) {
	this.year = nowValue.getFullYear();
});